package manong.controller;

import com.github.pagehelper.PageInfo;
import manong.constant.ServerResponse;
import manong.beans.Arrange;
import manong.service.IArrangeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/arrange/")
public class ArrangeController  {

    @Autowired
    private IArrangeService iArrangeService;

    @RequestMapping(value = "add",method = RequestMethod.GET)
    public ServerResponse<String> add(Arrange arrange) {
        return iArrangeService.add(arrange);
    }

/*
课程表实现为班级添加课的功能--》班级--》添加课程---》发起两次请求，用两个接口--》查询课程和查询老师的名字---》点击分配课程，向后端发起一次请求--》arrangecontroller-->  return iArrangeService.add(arrange);
  到业务层*/

    @RequestMapping("del")
    public ServerResponse<String> del( Integer id) {
        return iArrangeService.del(id);
    }

    @RequestMapping("update")
    public ServerResponse<String> update(Arrange arrange) {
        return iArrangeService.update(arrange);
    }

    @RequestMapping("find")
    public ServerResponse<Arrange> find(Integer id) {
        return iArrangeService.find(id);
    }

    @RequestMapping("findAll")
    public ServerResponse<PageInfo<Arrange>> findAll(Integer pageNum, Integer pageSize) {
        return iArrangeService.findAll(pageNum, pageSize);
    }

}
